<?php

namespace app\common\model;

use think\Model;

/**
 * 打赏模型
 */
class Says extends Model
{

    // 开启自动写入时间戳字段
    protected $autoWriteTimestamp = true;

    // 定义时间戳字段的格式
    // protected $dateFormat = 'Y-m-d H:i:s';
        // 关闭自动写入update_time字段
    // protected $updateTime = false;

    public function category(){
        return $this->belongsToMany('Category', 'Saysaccess', 'category_id', 'says_id');
    }

    public function imgs(){
        return $this->hasMany('Imgs');
    }

    public function user(){
        return $this->belongsTo('User')->field("nickname,id,avatar,username,bio");
    }
    
    public function zans(){
        return $this->hasMany('Zans');
    }
    
    public function comments(){
        return $this->hasMany('Comment');
    }

}
